package org.qiyu.live.account.provider;

import jakarta.annotation.Resource;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import qiyu.live.account.interfaces.IAccountTokenRpc;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-10-04
 * Time: 10:37
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableDubbo
public class AccountProviderApplication implements CommandLineRunner {

    @Resource
    private IAccountTokenRpc accountTokenRpc;

    public static void main(String[] args) {
        SpringApplication.run(AccountProviderApplication.class,args);
    }

    @Override
    public void run(String... args) throws Exception {
        Long userId = 12345L;
        String token = accountTokenRpc.createAndSaveLoginToken(userId);
        Long userIdByToken = accountTokenRpc.getUserIdByToken(token);
        System.out.println("userIdByToken : " + userIdByToken);
    }
}